
<style scoped>
.totalR {
  float:right;
  margin-right:8px;
  margin-top:6px;
  font-size: 14px;
  color:#666;
}
</style>
<!--  -->
<template>
  <div class="operate-log">
    <TipTotal :title="' 操作日志数据列表'">
      <template slot="total">
        <p class="totalR" v-if="total">总数：{{total}}</p>
      </template>
    </TipTotal>

    <!-- 查询列表 -->
    <SearchOperateLog :search="search" :resetData="resetData" :reset="reset" />

    <!-- 列表数据展示 -->
    <DataTable ref="dataTable" :search="search" :dataTotal="dataTotal" :searchPage="searchPage"
      :pageSize="search.pageSize" />
  </div>
</template>

<script>
import TipTotal from '@/components/common/TipTotal.vue'
import SearchOperateLog from '@/components/main/user/operate/log/SearchOperateLog.vue'
import DataTable from '@/components/main/user/operate/log/DataTable.vue'
export default {
  data () {
    return {
      total: 0,
      // search 查询数据
      search: {
        languageId: -1,
        userNames: '',
        modelNames: '',
        modelActions: '',
        likeContent: '',
        orderBy: 2,
        pageNumber: 1,
        pageSize: 12
      }
    }
  },
  methods: {
    // 设置总数
    dataTotal (total) {
      this.total = '' + total
    },
    searchPage (pageNumber) {
      this.search.pageNumber = pageNumber
    },
    // 重置数据
    resetData (obj) {
      if (typeof obj !== 'undefined' && obj.page && parseInt(obj.page) > 0) {
        this.search.pageNumber = obj.page
      }
      if (typeof obj !== 'undefined' && obj.modelName) {
        this.search.modelNames = obj.modelName
      } else {
        this.search.modelNames = ''
      }
      if (typeof obj !== 'undefined' && obj.modelAction) {
        this.search.modelActions = obj.modelAction
      } else {
        this.search.modelActions = ''
      }
      this.$refs['dataTable'].resetData()
    },
    // 重置查询
    reset () {
      this.search = {
        languageId: -1,
        userNames: '',
        modelNames: '',
        modelActions: '',
        likeContent: '',
        orderBy: 2,
        pageNumber: 1,
        pageSize: 12
      }
    }
  },
  components: {
    TipTotal,
    SearchOperateLog,
    DataTable
  }
}

</script>
